import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProstepVO, ProstepForm, ProstepQuery } from '@/api/basedata/prostep/types';

/**
 * 查询工序信息维护列表
 * @param query
 * @returns {*}
 */

export const listProstep = (query?: ProstepQuery): AxiosPromise<ProstepVO[]> => {
  return request({
    url: '/basedata/prostep/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工序信息维护详细
 * @param id
 */
export const getProstep = (id: string | number): AxiosPromise<ProstepVO> => {
  return request({
    url: '/basedata/prostep/' + id,
    method: 'get'
  });
};

/**
 * 新增工序信息维护
 * @param data
 */
export const addProstep = (data: ProstepForm) => {
  return request({
    url: '/basedata/prostep',
    method: 'post',
    data: data
  });
};

/**
 * 修改工序信息维护
 * @param data
 */
export const updateProstep = (data: ProstepForm) => {
  return request({
    url: '/basedata/prostep',
    method: 'put',
    data: data
  });
};

/**
 * 删除工序信息维护
 * @param id
 */
export const delProstep = (id: string | number | Array<string | number>) => {
  return request({
    url: '/basedata/prostep/' + id,
    method: 'delete'
  });
};
